package components;

import componentsAbstract.CompAbstract;

public class UserLogin extends CompAbstract{
	
	private TextBox login;
	private TextBox pass;
	private Button confirm;
	
	public UserLogin(TextBox login, TextBox pass, Button confirm) {
		this.login = login;
		this.pass = pass;
		this.confirm = confirm;
	}
	
	public boolean logIn() throws Exception
	{
		classInfo += " public boolean safeSendKeys(String value)";
		login.findObject();
		pass.findObject();
		confirm.findObject();
		
		checkComponents();
		
		login.safeSendKeys();
		pass.safeSendKeys();
		confirm.safeClick();
		
		
		return true;
	}
	
	private boolean checkComponents() throws Exception
	{
		classInfo += " public boolean safeSendKeys(String value)";
		login.sprawdzFieldObject(classInfo);
		login.sprawdzFieldValue(classInfo);
		login.sprawdzFieldName(classInfo);
		
		pass.sprawdzFieldObject(classInfo);
		pass.sprawdzFieldValue(classInfo);
		pass.sprawdzFieldName(classInfo);
		
		confirm.sprawdzFieldObject(classInfo);
		confirm.sprawdzFieldName(classInfo);

		return true;		
	}
	
	
}
